import { Directive, EventEmitter, HostBinding, HostListener, Input, Output } from "@angular/core";
import { Database } from "src/app/types/db/DbType";

@Directive({ selector: 'button[show-pwd]' })
export class ShowPassword {
  @Input('show-pwd')
  @HostBinding('class')
  btnClass?: string;

  @Input('db')
  db?: Database;

  @Output('show')
  show = new EventEmitter<string>();

  @HostListener('click')
  triggerShowEvent() {
    this.btnClass +=' clicked';
    this.show.emit(this.db?.password);
  }
}